function GSGamePlay () {
	var battle;
	
	var UI_ALPHA = 0.7;
	
	var PADDING_V_W = 15;
	var PADDING_V_H = CANVAS_H;
	var PADDING_H_W = 1250;
	var PADDING_H_H = 9;
	var paddingBarV = g_graphicEngine.LoadImage("Data/ActionPhase/UI/PaddingBarV.png");
	var paddingBarH = g_graphicEngine.LoadImage("Data/ActionPhase/UI/PaddingBarH.png");
	
	var FORCE_BAR_W = 300;
	var FORCE_BAR_H = 30;
	var FORCE_BAR_X = 860;
	var FORCE_BAR_Y = 10;
	var forceBar = g_graphicEngine.LoadImage("Data/ActionPhase/UI/ForceBar.png");
	
	var HP_BAR_W = 300;
	var HP_BAR_H = 35;
	var HP_BAR_X = 20;
	var HP_BAR_Y = 7;
	var HPBar = g_graphicEngine.LoadImage("Data/ActionPhase/UI/HPBar.png");
	
	var ENERGY_BAR_W = 300;
	var ENERGY_BAR_H = 35;
	var ENERGY_BAR_X = 370;
	var ENERGY_BAR_Y = 7;
	var energyBar = g_graphicEngine.LoadImage("Data/ActionPhase/UI/EnergyBar.png");
	
	var VIRTUAL_CONTROLLER_ARROW_SIZE = 120;
	var VIRTUAL_CONTROLLER_ARROW_X = 30;
	var VIRTUAL_CONTROLLER_ARROW_Y = 340;
	var virtualControllerArrow;
	if (PLATFORM > PLATFORM_DESKTOP)
		virtualControllerArrow = g_graphicEngine.LoadImage("Data/ActionPhase/UI/VirtualControllerArrow.png");
	
	var VIRTUAL_CONTROLLER_BOMB_SIZE = 180;
	var VIRTUAL_CONTROLLER_BOMB_X = 1080;
	var VIRTUAL_CONTROLLER_BOMB_Y = 530;
	var virtualControllerBomb;
	if (PLATFORM > PLATFORM_DESKTOP)
		virtualControllerBomb = g_graphicEngine.LoadImage("Data/ActionPhase/UI/VirtualControllerBomb.png");
	
	var arrowNeedToDrawFullAlpha = 0;
	var skillNeedToDrawFullAlpha = 0;
	
	var mousePressingLeft = 0;
	var mousePressOnArrow = 0;
	var mousePressingRight = 0;
	var mousePressOnSkill = 0;
	
	
	
	
	
	// MENU
	var FADE_SPEED = 4;
	
	var BACKGROUND_BLUR_R = 0;
	var BACKGROUND_BLUR_G = 1;
	var BACKGROUND_BLUR_B = 2;
	var BACKGROUND_BLUR_ALPHA = 0.6;
	
	
	var PANEL_X = 240;
	var PANEL_Y = 260;
	var PANEL_W = 800;
	var PANEL_H = 200;
	
	var panelImageHandle;
	
	var PAUSE_BUTTON_SXU = 0;
	var PAUSE_BUTTON_SYU = 0;
	var PAUSE_BUTTON_SXD = 0;
	var PAUSE_BUTTON_SYD = 50;
	var PAUSE_BUTTON_SW = 100;
	var PAUSE_BUTTON_SH = 50;
	
	var PAUSE_BUTTON_DX = 1165;
	var PAUSE_BUTTON_DY = 10;
	var PAUSE_BUTTON_DW = 100;
	var PAUSE_BUTTON_DH = 50;
	
	var pauseButton;
	
	var MENU_BUTTON_SXU = 0;
	var MENU_BUTTON_SYU = 0;
	var MENU_BUTTON_SXD = 0;
	var MENU_BUTTON_SYD = 150;
	var MENU_BUTTON_SW = 150;
	var MENU_BUTTON_SH = 150;
	
	var RESUME_BUTTON_DX = 265;
	var RESUME_BUTTON_DY = 285;
	var RESUME_BUTTON_DW = 150;
	var RESUME_BUTTON_DH = 150;
	
	var resumeButton;
	
	var OPTION_BUTTON_DX = 425;
	var OPTION_BUTTON_DY = 285;
	var OPTION_BUTTON_DW = 150;
	var OPTION_BUTTON_DH = 150;
	
	var optionButton;
	
	var SURRENDER_BUTTON_DX = 585;
	var SURRENDER_BUTTON_DY = 285;
	var SURRENDER_BUTTON_DW = 150;
	var SURRENDER_BUTTON_DH = 150;
	
	var surrenderButton;
	
	
	var QUIT_BUTTON_DX = 870;
	var QUIT_BUTTON_DY = 285;
	var QUIT_BUTTON_DW = 150;
	var QUIT_BUTTON_DH = 150;
	
	var quitButton;
	
	
	var blurBGAlpha = 0;
	var menuAlpha = 0;
	var isMenuOn = false;
	var isOptionOn = false;
	
	
	var chapter;
	var level;
	
	
	
	
	

	this.Init = function (chap, lev) {
		// Menu panel
		panelImageHandle = g_graphicEngine.LoadImage("Data/ActionPhase/Menu/MenuBG.png");
		
		// Button
		pauseButton = new Button();
		pauseButton.LoadImage("Data/ActionPhase/Menu/MenuButton.png", PAUSE_BUTTON_SXU, PAUSE_BUTTON_SYU, PAUSE_BUTTON_SXD, PAUSE_BUTTON_SYD, PAUSE_BUTTON_SW, PAUSE_BUTTON_SH);
		pauseButton.SetPosition (PAUSE_BUTTON_DX, PAUSE_BUTTON_DY, PAUSE_BUTTON_DW, PAUSE_BUTTON_DH);
		pauseButton.RegisterFunction(PauseAndDisplayMenu);
		
		resumeButton = new Button();
		resumeButton.LoadImage("Data/ActionPhase/Menu/ResumeButton.png", MENU_BUTTON_SXU, MENU_BUTTON_SYU, MENU_BUTTON_SXD, MENU_BUTTON_SYD, MENU_BUTTON_SW, MENU_BUTTON_SH);
		resumeButton.SetPosition (RESUME_BUTTON_DX, RESUME_BUTTON_DY, RESUME_BUTTON_DW, RESUME_BUTTON_DH);
		resumeButton.RegisterFunction(ResumeGame);
		
		optionButton = new Button();
		optionButton.LoadImage("Data/ActionPhase/Menu/OptionButton.png", MENU_BUTTON_SXU, MENU_BUTTON_SYU, MENU_BUTTON_SXD, MENU_BUTTON_SYD, MENU_BUTTON_SW, MENU_BUTTON_SH);
		optionButton.SetPosition (OPTION_BUTTON_DX, OPTION_BUTTON_DY, OPTION_BUTTON_DW, OPTION_BUTTON_DH);
		optionButton.RegisterFunction(GoToOption);
		
		surrenderButton = new Button();
		surrenderButton.LoadImage("Data/ActionPhase/Menu/SurrenderButton.png", MENU_BUTTON_SXU, MENU_BUTTON_SYU, MENU_BUTTON_SXD, MENU_BUTTON_SYD, MENU_BUTTON_SW, MENU_BUTTON_SH);
		surrenderButton.SetPosition (SURRENDER_BUTTON_DX, SURRENDER_BUTTON_DY, SURRENDER_BUTTON_DW, SURRENDER_BUTTON_DH);
		surrenderButton.RegisterFunction(Surrender);
		
		quitButton = new Button();
		quitButton.LoadImage("Data/ActionPhase/Menu/QuitButton.png", MENU_BUTTON_SXU, MENU_BUTTON_SYU, MENU_BUTTON_SXD, MENU_BUTTON_SYD, MENU_BUTTON_SW, MENU_BUTTON_SH);
		quitButton.SetPosition (QUIT_BUTTON_DX, QUIT_BUTTON_DY, QUIT_BUTTON_DW, QUIT_BUTTON_DH);
		quitButton.RegisterFunction(Quit);
		
		
		
		
		
		
		// Reset some variable
		arrowNeedToDrawFullAlpha = 0;
		skillNeedToDrawFullAlpha = 0;
	
		mousePressingLeft = 0;
		mousePressOnArrow = 0;
		mousePressingRight = 0;
		mousePressOnSkill = 0;
		
		menuAlpha = 0;
		isMenuOn = false;
		isOptionOn = false;
		
		
		
		
		
		// Load map
		chapter = chap;
		level = lev;
		
		battle = new Battle();
	}
	
	this.Update = function () {
		if (isMenuOn == false) {
			if (mousePressOnArrow > 0) {
				battle.OnKeyDown (mousePressOnArrow);
			}
			if (mousePressOnSkill > 0) {
				battle.OnKeyDown (mousePressOnSkill);
			}
			battle.Update();
			
			if (blurBGAlpha > 0) {
				blurBGAlpha -= g_deltaTime * 0.001 * FADE_SPEED;
				if (blurBGAlpha < 0) blurBGAlpha = 0;
			}
			if (menuAlpha > 0) {
				menuAlpha -= g_deltaTime * 0.001 * FADE_SPEED;
				if (menuAlpha < 0) menuAlpha = 0;
			}
		}
		else {
			if (blurBGAlpha < 1) {
				blurBGAlpha += g_deltaTime * 0.001 * FADE_SPEED;
				if (blurBGAlpha > 1) blurBGAlpha = 1;
			}
			if (isOptionOn == false) {
				if (menuAlpha < 1) {
					menuAlpha += g_deltaTime * 0.001 * FADE_SPEED;
					if (menuAlpha > 1) menuAlpha = 1;
				}
			}
			else {
				if (menuAlpha > 0) {
					menuAlpha -= g_deltaTime * 0.001 * FADE_SPEED;
					if (menuAlpha < 0) {
						menuAlpha = 0;
						g_gsOption.InvokeFromGamePlay();
						SwitchState (g_gsOption, false);
					}
				}
			}
		}
	}
	
	this.Draw = function () {
		// Draw the map, the penguin, the enemy, the bomb, the explosion, everything.... first
		battle.Draw();
		
		// Draw 4 padding bar around the map
		g_graphicEngine.DrawFast (g_context, paddingBarV, 0, 0);
		g_graphicEngine.Draw (g_context, paddingBarV, 0, 0, PADDING_V_W, PADDING_V_H, CANVAS_W - PADDING_V_W, 0, PADDING_V_W, PADDING_V_H, 1, 1, 0, 0);
		g_graphicEngine.DrawFast (g_context, paddingBarH, PADDING_V_W, 0);
		g_graphicEngine.Draw (g_context, paddingBarH, 0, 0, PADDING_H_W, PADDING_H_H, PADDING_V_W, CANVAS_H - PADDING_H_H, PADDING_H_W, PADDING_H_H, 1, 0, 1, 0);
		
		
		// Draw the HP bar
		var HPFPercentage = battle.GetMyPenguinHPPercentage();
		var HPEPercentage = 1 - HPFPercentage;
		g_graphicEngine.Draw (g_context, HPBar, (HPFPercentage * HP_BAR_W) >> 0, 0, (HP_BAR_W * HPEPercentage) >> 0, HP_BAR_H, HP_BAR_X + (HPFPercentage * HP_BAR_W) >> 0, HP_BAR_Y, (HP_BAR_W * HPEPercentage) >> 0, HP_BAR_H, UI_ALPHA);
		g_graphicEngine.Draw (g_context, HPBar, 0, HP_BAR_H, (HP_BAR_W * HPFPercentage) >> 0, HP_BAR_H, HP_BAR_X, HP_BAR_Y, (HP_BAR_W * HPFPercentage) >> 0, HP_BAR_H, UI_ALPHA);
		
		// Draw the energy bar
		var energyFPercentage = battle.GetMyPenguinEnergyPercentage();
		var energyEPercentage = 1 - energyFPercentage;
		g_graphicEngine.Draw (g_context, energyBar, (energyFPercentage * ENERGY_BAR_W) >> 0, 0, (ENERGY_BAR_W * energyEPercentage) >> 0, ENERGY_BAR_H, ENERGY_BAR_X + (energyFPercentage * ENERGY_BAR_W) >> 0, ENERGY_BAR_Y, (ENERGY_BAR_W * energyEPercentage) >> 0, ENERGY_BAR_H, UI_ALPHA);
		g_graphicEngine.Draw (g_context, energyBar, 0, ENERGY_BAR_H, (ENERGY_BAR_W * energyFPercentage) >> 0, ENERGY_BAR_H, ENERGY_BAR_X, ENERGY_BAR_Y, (ENERGY_BAR_W * energyFPercentage) >> 0, ENERGY_BAR_H, UI_ALPHA);
		
		// Draw the throw force bar
		var throwForceFPercentage = battle.GetThrowForcePercentage(); 
		var throwForceEPercentage = 1 - throwForceFPercentage;
		g_graphicEngine.Draw (g_context, forceBar, (throwForceFPercentage * FORCE_BAR_W) >> 0, 0, (FORCE_BAR_W * throwForceEPercentage) >> 0, FORCE_BAR_H, FORCE_BAR_X + (throwForceFPercentage * FORCE_BAR_W) >> 0, FORCE_BAR_Y, (FORCE_BAR_W * throwForceEPercentage) >> 0, FORCE_BAR_H, UI_ALPHA);
		g_graphicEngine.Draw (g_context, forceBar, 0, FORCE_BAR_H, (FORCE_BAR_W * throwForceFPercentage) >> 0, FORCE_BAR_H, FORCE_BAR_X, FORCE_BAR_Y, (FORCE_BAR_W * throwForceFPercentage) >> 0, FORCE_BAR_H, UI_ALPHA);
		
		
		
		
		if (PLATFORM > PLATFORM_DESKTOP) {
			if (arrowNeedToDrawFullAlpha == 37)
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 0, 0, 0);
			else 
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, UI_ALPHA, 0, 0, 0);
			
			if (arrowNeedToDrawFullAlpha == 38)
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 0, 0, 90);
			else
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, UI_ALPHA, 0, 0, 90);
			
			if (arrowNeedToDrawFullAlpha == 39)
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 1, 0, 0);
			else
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, UI_ALPHA, 1, 0, 0);
			
			if (arrowNeedToDrawFullAlpha == 40)
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, 1, 1, 0, 90);
			else
				g_graphicEngine.Draw (g_context, virtualControllerArrow, 0, 0, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2, VIRTUAL_CONTROLLER_ARROW_SIZE, VIRTUAL_CONTROLLER_ARROW_SIZE, UI_ALPHA, 1, 0, 90);
				
			if (skillNeedToDrawFullAlpha == 32)
				g_graphicEngine.Draw (g_context, virtualControllerBomb, 0, 0, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_X, VIRTUAL_CONTROLLER_BOMB_Y, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, 1, 0, 0, 0);
			else 
				g_graphicEngine.Draw (g_context, virtualControllerBomb, 0, 0, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_X, VIRTUAL_CONTROLLER_BOMB_Y, VIRTUAL_CONTROLLER_BOMB_SIZE, VIRTUAL_CONTROLLER_BOMB_SIZE, UI_ALPHA, 0, 0, 0);
		}
		
		
		// Button
		pauseButton.Draw();
		
		
		
		if (blurBGAlpha > 0) {
			g_graphicEngine.FillCanvas (g_context, BACKGROUND_BLUR_R, BACKGROUND_BLUR_G, BACKGROUND_BLUR_B, BACKGROUND_BLUR_ALPHA * blurBGAlpha, 0, 0, CANVAS_W, CANVAS_H);
		}
		if (menuAlpha > 0) {
			g_graphicEngine.SetGlobalAlpha (menuAlpha);
			g_graphicEngine.DrawFast (g_context, panelImageHandle, PANEL_X, PANEL_Y);
			
			resumeButton.Draw();
			optionButton.Draw();
			surrenderButton.Draw();
			quitButton.Draw();
			
			g_graphicEngine.SetGlobalAlpha (1);
		}
	}
	
	this.OnSwitch = function () {
	
	}
	
	this.OnMouseMove = function (x, y) {
		if (isMenuOn == false) {
			if (PLATFORM > PLATFORM_DESKTOP) {
				if (mousePressingLeft == true) {
					if (x < CANVAS_W * 0.5) {
						if (x >= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2
						&&  y >= VIRTUAL_CONTROLLER_ARROW_Y && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE) {
							mousePressOnArrow = 38;
						}
						else if (x >= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2 && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 3
						&&  y >= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2) {
							mousePressOnArrow = 39;
						}
						else if (x >= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE * 2
						&&  y >= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2 && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 3) {
							mousePressOnArrow = 40;
						}
						else if (x >= VIRTUAL_CONTROLLER_ARROW_X && x <= VIRTUAL_CONTROLLER_ARROW_X + VIRTUAL_CONTROLLER_ARROW_SIZE
						&&  y >= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE && y <= VIRTUAL_CONTROLLER_ARROW_Y + VIRTUAL_CONTROLLER_ARROW_SIZE * 2) {
							mousePressOnArrow = 37;
						}
						else {
							mousePressOnArrow = 0;
						}
					}
				}
				else {
					mousePressOnArrow = 0;
				}
				
				if (mousePressingRight == true) {
					if (x >= CANVAS_W * 0.5) {
						if (x >= VIRTUAL_CONTROLLER_BOMB_X && x <= VIRTUAL_CONTROLLER_BOMB_X + VIRTUAL_CONTROLLER_BOMB_SIZE
						&&  y >= VIRTUAL_CONTROLLER_BOMB_Y && y <= VIRTUAL_CONTROLLER_BOMB_Y + VIRTUAL_CONTROLLER_BOMB_SIZE) {
							mousePressOnSkill = 32;
						}
						else {
							mousePressOnSkill = 0;
						}
					}
				}
				else {
					mousePressOnSkill = 0;
				}
				
				arrowNeedToDrawFullAlpha = mousePressOnArrow;
				skillNeedToDrawFullAlpha = mousePressOnSkill;
			}
			
			
			// Button
			pauseButton.OnMouseMove (x, y);
		}
		else {
			resumeButton.OnMouseMove (x, y);
			optionButton.OnMouseMove (x, y);
			surrenderButton.OnMouseMove (x, y);
			quitButton.OnMouseMove (x, y);
		}
	}
	
	this.OnMouseDown = function (x, y) {
		if (isMenuOn == false) {
			if (PLATFORM > PLATFORM_DESKTOP) {
				if (x < CANVAS_W * 0.5) {
					mousePressingLeft = true;
				}
				else {
					mousePressingRight = true;
				}
				this.OnMouseMove (x, y);
			}
			
			// Button
			pauseButton.OnMouseDown (x, y);
		}
		else {
			resumeButton.OnMouseDown (x, y);
			optionButton.OnMouseDown (x, y);
			surrenderButton.OnMouseDown (x, y);
			quitButton.OnMouseDown (x, y);
		}
	}
	
	this.OnMouseUp = function (x, y) {
		if (isMenuOn == false) {
			if (PLATFORM > PLATFORM_DESKTOP) {
				if (x < CANVAS_W * 0.5) {
					mousePressingLeft = false;
					battle.OnKeyUp (mousePressOnArrow);
					mousePressOnArrow = 0;
					arrowNeedToDrawFullAlpha = 0;
				}
				else {
					mousePressingRight = false;
					battle.OnKeyUp (mousePressOnSkill);
					mousePressOnSkill = 0;
					skillNeedToDrawFullAlpha = 0;
				}
			}
			
			// Button
			pauseButton.OnMouseUp (x, y);
		}
		else {
			resumeButton.OnMouseUp (x, y);
			optionButton.OnMouseUp (x, y);
			surrenderButton.OnMouseUp (x, y);
			quitButton.OnMouseUp (x, y);
		}
	}
	
	this.OnMouseWheel = function (delta) {
	
	}
	
	
	var keycode1 = 0;
	var keycode2 = 0;
	
	this.OnKeyDown = function (keycode) {
		if (keycode >= 37 && keycode <= 40) {
			if (keycode == keycode1) return;
			if (keycode == keycode2) return;
			
			if (keycode1 == 0)	keycode1 = keycode;
			else 				keycode2 = keycode;
			
			battle.OnKeyDown (keycode);
		}
		else if (keycode == 32) {
			battle.OnKeyDown (32);
		}
	}
	
	this.OnKeyUp = function (keycode) {
		if (keycode >= 37 && keycode <= 40) {
			if (keycode1 == keycode) keycode1 = 0;
			if (keycode2 == keycode) keycode2 = 0;
			
			if (keycode1 >= 37 && keycode1 <= 40) {
				battle.OnKeyDown (keycode1);
			}
			else  {
				if (keycode2 >= 37 && keycode2 <= 40) {
					battle.OnKeyDown (keycode2);
				}
				else {                                  
					battle.OnKeyUp (keycode);
				}
			}
		}
		else if (keycode == 32) {
			battle.OnKeyUp(32);
		}
	}
	
	
	
	var PauseAndDisplayMenu = function () {
		isMenuOn = true;
	}
	
	var ResumeGame = function () {
		isMenuOn = false;
	}
	
	var GoToOption = function () {
		isOptionOn = true;
	}
	
	var Surrender = function () {
		g_gsLevel.ChapterSelected (chapter);
		SwitchState (g_gsLevel, true);
	}
	
	var Quit = function () {
	
	}
	
	
	
	this.ReturnFromOptionScreen = function () {
		isOptionOn = false;
	}
}